/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.*;

/**
 *
 * @author Human Booster
 */
@Entity
@Table(name = "licencesoftware")
@NamedQueries({
    @NamedQuery(name = "Licencesoftware.findAll", query = "SELECT l FROM Licencesoftware l"),
    @NamedQuery(name = "Licencesoftware.findById", query = "SELECT l FROM Licencesoftware l WHERE l.licencesoftwarePK.id = :id"),
    @NamedQuery(name = "Licencesoftware.findByName", query = "SELECT l FROM Licencesoftware l WHERE l.name = :name"),
    @NamedQuery(name = "Licencesoftware.findByLifeTimeid", query = "SELECT l FROM Licencesoftware l WHERE l.licencesoftwarePK.lifeTimeid = :lifeTimeid"),
    @NamedQuery(name = "Licencesoftware.findBySoftwareid", query = "SELECT l FROM Licencesoftware l WHERE l.licencesoftwarePK.softwareid = :softwareid"),
    @NamedQuery(name = "Licencesoftware.findByLicenceCounterLimitid", query = "SELECT l FROM Licencesoftware l WHERE l.licencesoftwarePK.licenceCounterLimitid = :licenceCounterLimitid")})
public class Licencesoftware implements Serializable {
    @Lob
    @Column(name = "menuactivation")
    private byte[] menuactivation;
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected LicencesoftwarePK licencesoftwarePK;
    @Basic(optional = false)
    @Column(name = "name")
    private String name;
    @JoinColumn(name = "LicenceCounterLimit_id", referencedColumnName = "id", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Licencecounterlimit licencecounterlimit;
    @JoinColumn(name = "Software_id", referencedColumnName = "id", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Software software;
    @JoinColumn(name = "LifeTime_id", referencedColumnName = "id", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Lifetime lifetime;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "licencesoftware")
    private Collection<Licencecustomer> licencecustomerCollection;

    public Licencesoftware() {
    }

    public Licencesoftware(LicencesoftwarePK licencesoftwarePK) {
        this.licencesoftwarePK = licencesoftwarePK;
    }

    public Licencesoftware(LicencesoftwarePK licencesoftwarePK, String name) {
        this.licencesoftwarePK = licencesoftwarePK;
        this.name = name;
    }

    public Licencesoftware(int id, int lifeTimeid, int softwareid, int licenceCounterLimitid) {
        this.licencesoftwarePK = new LicencesoftwarePK(id, lifeTimeid, softwareid, licenceCounterLimitid);
    }

    public LicencesoftwarePK getLicencesoftwarePK() {
        return licencesoftwarePK;
    }

    public void setLicencesoftwarePK(LicencesoftwarePK licencesoftwarePK) {
        this.licencesoftwarePK = licencesoftwarePK;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Licencecounterlimit getLicencecounterlimit() {
        return licencecounterlimit;
    }

    public void setLicencecounterlimit(Licencecounterlimit licencecounterlimit) {
        this.licencecounterlimit = licencecounterlimit;
    }

    public Software getSoftware() {
        return software;
    }

    public void setSoftware(Software software) {
        this.software = software;
    }

    public Lifetime getLifetime() {
        return lifetime;
    }

    public void setLifetime(Lifetime lifetime) {
        this.lifetime = lifetime;
    }

    public Collection<Licencecustomer> getLicencecustomerCollection() {
        return licencecustomerCollection;
    }

    public void setLicencecustomerCollection(Collection<Licencecustomer> licencecustomerCollection) {
        this.licencecustomerCollection = licencecustomerCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (licencesoftwarePK != null ? licencesoftwarePK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Licencesoftware)) {
            return false;
        }
        Licencesoftware other = (Licencesoftware) object;
        if ((this.licencesoftwarePK == null && other.licencesoftwarePK != null) || (this.licencesoftwarePK != null && !this.licencesoftwarePK.equals(other.licencesoftwarePK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Licencesoftware[ licencesoftwarePK=" + licencesoftwarePK + " ]";
    }

    public byte[] getMenuactivation() {
        return menuactivation;
    }

    public void setMenuactivation(byte[] menuactivation) {
        this.menuactivation = menuactivation;
    }
    
}
